package com.ruoyi.coupon.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.coupon.domain.CouponRecord;
import com.ruoyi.coupon.model.CouponRecordDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * couponrecordMapper接口
 *
 * @author 林道敬
 * @date 2025-01-02
 */
public interface CouponRecordMapper extends BaseMapper<CouponRecord>
{
    /**
     * 查询couponrecord
     *
     * @param id couponrecord主键
     * @return couponrecord
     */
    public CouponRecord selectCouponRecordById(String id);

    /**
     * 查询couponrecord列表
     *
     * @param couponRecord couponrecord
     * @return couponrecord集合
     */
    public List<CouponRecord> selectCouponRecordList(CouponRecord couponRecord);

    /**
     * 新增couponrecord
     *
     * @param couponRecord couponrecord
     * @return 结果
     */
    public int insertCouponRecord(CouponRecord couponRecord);

    /**
     * 修改couponrecord
     *
     * @param couponRecord couponrecord
     * @return 结果
     */
    public int updateCouponRecord(CouponRecord couponRecord);

    /**
     * 删除couponrecord
     *
     * @param id couponrecord主键
     * @return 结果
     */
    public int deleteCouponRecordById(String id);

    /**
     * 批量删除couponrecord
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteCouponRecordByIds(String[] ids);

    int lockUseStateBatch(@Param("userId") Long userId, @Param("useState") String useState, @Param("lockCouponRecordIds") List<Long> lockCouponRecordIds);

    /**
     * 更新优惠券使用记录
     * @param couponRecordId
     * @param
     */
    void updateState(@Param("couponRecordId") Long couponRecordId, @Param("useState") String useState);
}
